package com.cyn.controller.swagger;


import com.cyn.controller.swagger.dto.UserDTO;
import com.cyn.entity.SysUser;
import com.cyn.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/swagger/test")
@Api(value = "SwaggerController", tags = {"用户管理相关操作接口"})
public class SwaggerController {

    @Autowired
    SysUserService sysUserService;

    @GetMapping("test3")
    @ApiOperation(value = "swagger测试接口", notes = "swagger测试接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "testname", value = "testname", dataType = "String",
                    defaultValue = "10", required = true)
    })
    public UserDTO test3(String testname) {
        SysUser tmp = sysUserService.get(1l);

        UserDTO dto = new UserDTO();
        dto.setId(tmp.getId());
        dto.setLoginName(tmp.getLoginName());
        dto.setUserName(tmp.getUserName());
        dto.setSex(tmp.getSex());

        return dto;
    }
}
